#include <iostream>
#include "common.h"
using namespace std;
/* 
计算但链表的长度
 */
int length(linklist l)
{
    lnode *p = l->next;
    int length = 0;
    while (p)
    {
        length++;
        p = p->next;
    }
    return length;
}
int main(int argc, char const *argv[])
{
    linklist l;
    int a[] = {1, 2, 3, 4, 5, 6, 7, 8, 9};
    makelist(l, a, sizeof(a) / sizeof(int));
    cout << length(l) << endl;
    return 0;
}